#ifndef FFAENCODERTHREAD_H
#define FFAENCODERTHREAD_H

#include"ffthread.h"

extern "C"{
#include<libavformat/avformat.h>
}
class FFAudioPars;
class FFAEncoder;
class FFAFrameQueue;
class FFADecoder;
class FFMuxer;

class FFAEncoderThread : public FFThread
{
public:
    FFAEncoderThread();
    virtual ~FFAEncoderThread()override;
    void init(FFAEncoder* aEncoder_,FFMuxer*muxer_,FFADecoder*aDecoder_, FFAFrameQueue* frmQueue_);

protected:
    virtual void run() override;

private:
    void initEncoder(AVFrame* frame);

private:
    FFAudioPars* aPars = nullptr;
    FFADecoder*aDecoder = nullptr;
    FFAEncoder* aEncoder = nullptr;
    FFAFrameQueue* frmQueue = nullptr;
    FFMuxer* muxer = nullptr;
    AVRational microphoneTimeBase;
    int64_t audioPts = 0;
    int streamIndex = -1;
};

#endif // FFAENCODERTHREAD_H
